//
//  Refuse.m
//  ios-supplier
//
//  Created by feynmanyuan on 15/4/19.
//  Copyright (c) 2015年 feynmanyuan. All rights reserved.
//

#import "RefusePartialView.h"
#import "JFBRefuseOrderDS.h"
#import "JFBPhoneCallHelper.h"

@interface RefusePartialView() {
//    UIButton *_call;
//    JFBPhoneCallHelper *_callHelper;
}
@property (weak, nonatomic) IBOutlet UILabel *refuseLabel;
//@property (weak, nonatomic) IBOutlet UILabel *staffLabel;

@end
@implementation RefusePartialView

- (void)setOrder:(JFBOrderDS*)order1{
    self.drawLineHelper = [[JFBDrawLineHelper alloc]init];
    
    JFBRefuseOrderDS *order = (JFBRefuseOrderDS*)order1;
    
    NSString *role = [NSString stringWithFormat:@"【%@取消】%@", order.role, order.reason];
    CGSize roleSize = [role sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:TextFontSizeH2]}];
    CGFloat roleX = kOrderCellMargin;
    CGFloat roleY = (kOrderCellHeaderHeight + kOrderCellSpacing * 2 - roleSize.height) / 2;//(kOrderCellHeaderHeight - roleSize.height) / 2;
    CGRect roleRect = CGRectMake(roleX, roleY, roleSize.width > self.bounds.size.width * 0.65 ? self.bounds.size.width * 0.65 : roleSize.width, roleSize.height);
    self.refuseLabel.text = role;
    self.refuseLabel.frame = roleRect;
    
//    [self.drawLineHelper addHorizontalLine:0 y:kOrderCellHeaderHeight color:LineColorImportant width:self.bounds.size.width * 0.65];
    
//    NSString *staff = [NSString stringWithFormat:@"配送:%@(%@)", order.staff, order.staffMobile];
//    
//    CGSize staffSize = [staff sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:TextFontSizeH3]}];
//    CGFloat staffX = kOrderCellSpacing, staffY = kOrderCellHeaderHeight + kOrderCellSpacing;
//    CGRect staffRect = CGRectMake(staffX, staffY, staffSize.width, staffSize.height);
//    self.staffLabel.text = staff;
//    self.staffLabel.frame = staffRect;
    
//    _callHelper = [[JFBPhoneCallHelper alloc] initWithMobile:order.userMobile color:TextColorSpecialButton];
//    _call = [_callHelper getButton];
//    [self addSubview:_call];
//    CGRect callRect = CGRectMake(self.bounds.size.width - kOrderCellSpacing - 88, kOrderCellSpacing, 88, 36);
//    _call.frame = callRect;
    
    self.height = kOrderCellHeaderHeight + kOrderCellSpacing * 2; //CGRectGetMaxY(self.refuseLabel.frame) + kOrderCellSpacing;
}


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
//- (void)drawRect:(CGRect)rect {
//    // Drawing code
//}

@end
